/**
 * 测试调用Reflection getCallerClass 获取调用者信息
 * 会出现CallerSensitive annotation expected at frame 1
 *
 * http://www.itzhai.com/get-invoker-by-stacktrace-and-getcallerclass.html#read-more
 *
 * 现在已不推荐调用Reflection.getCallerClass方法
 * 而是用 StackTraceElement[] elements = new Throwable().getStackTrace(); 方法栈
 */

public class CallerApp {

    public static void main(String[] args) {
        CalleeApp app = new CalleeApp();
        Caller1 c1 = new Caller1();
        c1.run(app);
    }

    static class Caller1 {
        void run(CalleeApp calleeApp) {
            if (calleeApp == null) {
                throw new IllegalArgumentException("callee can not be null");
            }
            calleeApp.call();
        }
    }

}
